/**
 * 
 */
package com.effectivsocial.domain;

import java.io.Serializable;
import java.util.Date;
import java.util.List;


import jodd.util.StringUtil;
import lombok.Getter;
import lombok.Setter;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * @author Dhrubo
 * 
 */
@Document(collection="User")
public class User implements Serializable{
	private static final long serialVersionUID = 1L;
	
	@Getter @Setter
	@Id
	private String id;
	
	@Getter @Setter
	private String firstName;
	
	@Getter @Setter
	private String lastName;
	
	@Getter @Setter
	@Indexed(unique=true)
	private String email;
	
	@Getter @Setter
	private String password;
	
	@Getter @Setter
	private Date createdDate;
	
	@Getter @Setter
	private Date lastModifiedDate;
	
	@Getter @Setter
	private Date activationDate;
	
	@Getter @Setter
	private boolean activated;
	
	@Getter @Setter
	private boolean deleted;
	
	@Getter @Setter
	private boolean locked;
	
	@Getter @Setter
	private List<Role> roles;    
	
	@Getter @Setter
	private String theme;
	
	@Getter @Setter
	@DBRef
	private Company company;

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		User other = (User) obj;
		return StringUtil.equals(this.getId(), other.getId());
	}

	
}
